<!--
 * @Author: MarioGo
 * @Date: 2021-11-06 13:14:00
 * @LastEditTime: 2021-11-20 15:02:57
 * @LastEditors: MarioGo
 * @Description: 文件描述
 * @FilePath: /zheye/src/App.vue
 * 可以输入预定的版权声明、个性签名、空行等
-->
<template>
  <div class="container-fluid px-0 flex-shrink-0">
    <global-header :user="currentUser"></global-header>
    <router-view></router-view>
    <loader v-if="isLoading" text="拼命加载中" background="rgba(0, 0, 0, 0.8)"></loader>
  </div>
  <footer class="text-center py-4 text-secondary bg-light mt-auto">
    <small>
      <ul class="list-inline mb-0">
        <li class="list-inline-item">© 2020 者也专栏</li>
        <li class="list-inline-item">课程</li>
        <li class="list-inline-item">文档</li>
        <li class="list-inline-item">联系</li>
        <li class="list-inline-item">更多</li>
      </ul>
    </small>
  </footer>
</template>

<script lang="ts">
import { computed, defineComponent } from 'vue';
import GlobalHeader from './components/GlobalHeader.vue';
import Loader from './components/ Loader.vue';
import { useStore } from 'vuex';
import { GlobalDataProps } from './store';

export default defineComponent({
  components: {
    GlobalHeader,
    Loader,
  },
  setup() {
    const store = useStore<GlobalDataProps>();
    const currentUser = computed(() => store.state.user);
    const isLoading = computed(() => store.state.loading);
    const error = computed(() => store.state.error);

    return {
      currentUser,
      isLoading,
      error,
    };
  },
});
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}
.container {
  display: flex;
  flex-direction: column;
}
</style>
